package tech.aistar.service.booking.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tech.aistar.dao.IBookingDao;
import tech.aistar.entity.Booking;
import tech.aistar.service.booking.IBookingService;

import java.util.List;

/**
 * @Author: lya
 * @Description: 本类的作用描述:
 * @CreateDate: 2019/10/13
 * @Version: 1.0
 */
@Service
public class BookingServiceImpl implements IBookingService{
    @Autowired
    private IBookingDao bookingDao;
    @Override
    public List<Booking> findAll() {
        List<Booking> list = bookingDao.findAll();
        return list;
    }

    @Override
    public List<Booking> findAllById(Integer id) {
        List<Booking> list = bookingDao.findAllById(id);
        return list;
    }
    @Override
    public Booking findById(Integer id) {
        Booking booking = bookingDao.findById(id).get();
        return booking;
    }

    @Override
    public void delById(Integer id) {
        bookingDao.deleteById(id);
    }

    @Override
    public void add(Booking booking) {
        bookingDao.save(booking);
    }

    @Override
    public void modifiy(Booking booking) {
        bookingDao.save(booking);

    }
}
